package com.et.sale.deposit.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.et.sale.deposit.entity.DepositEntity;
import com.et.sale.deposit.service.DepositService;

@Controller
@RequestMapping("/chongzhi")
public class DepositController {
	
	@Autowired
	private DepositService service;
	
	
	@RequestMapping("/add")
	public String chongzhi(DepositEntity entity,HttpServletRequest request){
		
		Integer userId = null;
		Object object = request.getSession().getAttribute("userId");
		if(null == object){
			return "user/login";
		}else{
			userId = Integer.parseInt(object.toString());
			entity.setUserId(userId);
			service.chongzhi(entity);
			return "forward:/ticket/list.do";
			
		}
		
		
		
	}

}
